#ifndef PARSETSLENGTH_H
#define PARSETSLENGTH_H
#include <stdio.h>
#include <string.h>

class ParseTSLength
{
public:
    ~ParseTSLength();
    ParseTSLength(const ParseTSLength&)=delete;
    ParseTSLength& operator=(const ParseTSLength&)=delete;
    static ParseTSLength& get_instance();

    /************************************************************************************************************************************
     * Function Name : ParseTSPackageLength
     * Description   : parse the  package length
     * Parameters    :
     *				pfTsFile -- the file descriptor
     *				piTsPosition -- the package position(return the package begin position)
     * Returns       : -1 - the file is not the transport stream >0 - success and return the  package length
     ************************************************************************************************************************************/
    int ParseTsLength(FILE *pfTsFile, int *piTsPosition);
private:
    /*********************************************************************************************************************************
     * Function Name : JudgmentPackage
     * Description   : judgment 10 package whether the package length is 188 or 204
     * Parameters    :
     *				pfTsFile -- the file descriptor
     *				iTsPosition -- the package begin position pay attention we define the first position is 0
     *              iTsLength -- the package length which we want to judgment
     * Returns       : -1 - judgment failure >0 - judgment success return the package length
     ********************************************************************************************************************************/
    int JudgmentPackageTenTimes(FILE *pfTsFile, int iTsPosition, int iTsLength);
private:
    ParseTSLength();
};

#endif // PARSETSLENGTH_H
